#pragma once

#include <string>
#include "uv.h"

namespace uvpp
{
	using TCPPtr = std::shared_ptr<uv_tcp_t>;

	enum class IPFamily
	{
		IPv4 = 0,
		IPv6
	};

	class InetAddress
	{
	public:
		InetAddress(const std::string& ip, unsigned short port, IPFamily ipv = IPFamily::IPv4);
		InetAddress(const std::string&& ip, unsigned short port, IPFamily ipv = IPFamily::IPv4);
		InetAddress(const sockaddr* addr, IPFamily ipv = IPFamily::IPv4);
		~InetAddress();

		const sockaddr* addr();

	private:
		std::string _ip;
		unsigned short _port;
		IPFamily _ipv;
		struct sockaddr_in _ip4;
		struct sockaddr_in _ip6;
	};
}